package adfc2.actions;

import adfc2.core.Creature;
import adfc2.core.Item;
import adfc2.entities.DroppedItem;

public class DropAction extends InstantAction {

    public final Item item;

    public DropAction(Creature actor, Item item) {
        super(actor);
        this.item = item;
    }

    @Override
    protected boolean perform() {
        assert actor.hasItem(item);
        actor.removeItem(item);
        new DroppedItem(item).register(actor.getXY());
        return true;
    }

    @Override
    public String toString() {
        return "DropAction[" + item + "]";
    }
}
